#!/usr/bin/env python

import random
import sys
import numpy

m = random.randint(1, 20)

print m

dim = m,m
a = {}



adj = ['0', '1']

alfabeto = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', 'z']

for i in range (m):
	vertice = alfabeto[random.randint(0, 22)]
	print vertice


for i in range (m):
	
	linha = ""
	for j in range (m):
		
		ad = adj[random.randint(0,1)]
		if (i != j):
			
				a[i,j] = ad
				
			
				a[j,i] = a[i,j]
				
		else: 
			
				a[i,j] = '0'
					
		
						
	
for i in range(m):
	for j in range(m):
            print a[i,j],
        print ""
	

	
